package wang;

public class MaxDemo {
    public static void main(String[] args) {
        int[] source = {15, 9000, 1000, 20000, 9500, -5};
        int max=source[0];
        int min =source[0];
        for (int i = 0; i < source.length; i++) {
            if(source[i] > max){
                max=source[i];
            }

        }
        for (int j = 0; j < source.length; j++) {
            if(min < source[j]){
                min = min;
            } else  {
                min = source[j];
            }

        }
        System.out.println("最大值是： "+ max);
        System.out.println("最小值是: " + min);
    }
}
